<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>箭头函数</title>
</head>
<body>
<script>
    let arr = [1, 2, 3, 4];
    let newArr = arr.filter(function (item) {
        return item < 2.5
    });

    console.log(arr, newArr);// [1, 2]

    let newArr1 = arr.filter(item => item < 2.5);

    //箭头函数 (匿名函数 lamda 入
    //后台语言 java php c++ c# (强类型
//    ->
    /*public fn1 (a: int, b: int, c: any): string -> {
        return a + b
    }*/

    function sum(a, b) {
        return a + b
    }
    sum(1, 2);//3
    sum("1", "2");//"12"
    sum("1", 2);//"12"
    sum(1, "2");//"12"



    function fn() {//具名

    }
    let fn = function () {

    };

    let fn = ()=>{

    }





</script>
</body>
</html>